<template>
  <div class="play_list_top">
    <div class="left">
      <div class="icon">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-bofang2"></use>
        </svg>
      </div>
      <div class="content">
        播放全部（共{{ detail.trackCount }}首）
      </div>
    </div>
    <div class="right">
      +收藏{{ detail.subscribedCount }}首
    </div>
  </div>

  <div class="play_list">
    <ul>
      <li class="play_list_item" v-for="(item,i) in detail.tracks" :key="i" @click="setCurrent_index(i)">
        <div class="left">
          <span>{{ i+1 }}</span>
          <div class="content">
            <div class="title">{{ item.name }}</div>
          </div>
        </div>
        <div class="right">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-Play"></use>
          </svg>
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-gengduo"></use>
          </svg>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
import {mapMutations} from "vuex"
export default {
  name: "PlayList",
  props:["detail"],
  methods:{
     ...mapMutations(['setCurrent_index']),
  }
}
</script>

<style scoped lang="less">
.play_list_top{
  height: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fff;
  border-radius: 0.30rem 0.30rem 0 0 ;
  margin-top: 0.5rem;
  padding: 0 0.3rem;
  color: #444;
  .left{
    display: flex;
    justify-content: space-between;
    align-items: center;
    .icon{
      width: 0.4rem;
      height: 0.4rem;
    }
    .content{
      font-size: 0.24rem;
      margin-left: 0.2rem;
    }
  }
  .right{
    padding: 0.2rem 0.4rem;
    background-color: #e92323;
    border-radius: 0.8rem;
    font-size: 0.24rem;
    color: #fff;
  }
}
.play_list{
  background-color: #fff;
  width: 7.5rem;
  padding: 0 0.4rem 1rem 0.4rem;
  align-items: center;
  .play_list_item{
    height: 1rem;
    align-items: center;
    display: flex;
    justify-content: space-between;
    .left{
      display: flex;
      justify-content: space-between;
      span{
        margin-right: 0.4rem;
        color: #999;
      }
      .title{
        width: 4.5rem;
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
      }
    }
    .right{
      .icon{
        margin-left: 0.4rem;
        fill: #999;
      }
    }
  }
}

</style>